<?php

namespace app\admin\validate;

use think\Validate;

class Goods extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'id' => 'require',
        'goods_name' => 'require',
        'sub_title' => 'require',
        'images' => 'require',
        'price' => 'require',
        'type' => 'require',
        'shelf' => 'require',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'id.require' => '请填写ID',
        'goods_name.require' => '请填写商品名称',
        'sub_title.require' => '请填写副标题',
        'images.require' => '请填写商品图片',
        'price.require' => '请填写商品价格',
        'type.require' => '请填写类型:1=首页,2=其他',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['goods_name', 'sub_title', 'images', 'price', 'type'],
        'edit' => ['id','goods_name', 'sub_title', 'images', 'price', 'type'],
    ];
    
}
